<?php
 
//统计redis数据并放在一个文件里
    $redis=new Redis();
    $redis->connect('localhost','6379');
    $filebase=dirname(__FILE__).'/../../interfaces/log/';
    date_default_timezone_set("Asia/Shanghai");
    $dateMonth=date("Y-m");
    $redis->select(1);
    $ary=$redis->keys("*_log_queue*");
    foreach( $ary as $lkey){
        if(stripos($lkey,"Ali")===0){
             $filebase=$filebase.'AliFlowWallet/';
        }elseif(stripos($lkey,"CMCC")===0){
             $filebase=$filebase.'CMCC/';
        }elseif(stripos($lkey,"CUCC")===0){
             $filebase=$filebase.'CUCC/';
        }elseif(stripos($lkey,"CTCC")===0){
             $filebase=$filebase.'CTCC/';
        }elseif(stripos($lkey,"DHST")===0){
             $filebase=$filebase.'DHST/';
        }elseif(stripos($lkey,"YG")===0){
             $filebase=$filebase.'YG/';
        }
        while($lval =$redis->lpop($lkey)){
            file_put_contents($filebase.$lkey.$dateMonth,$lval."\n",FILE_APPEND);
        }
       
    }
   ?>